import Vue from 'vue'
import Router from 'vue-router'
import Home from '@/views/Home'
import List from '@/views/List'
import Goods from '@/views/Goods'
import Login from '@/views/Login'
import Storeinfo from '@/views/Storeinfo'
import Storelist from '@/views/Storelist'
import Shoppingcart from '@/views/Shoppingcart'
import LoginS from '@/views/LoginS'
import Entry from '@/views/Entry'
import EntryS from '@/views/EntryS'
import Details from '@/views/Details'
import Shopdetails from '@/views/Shopdetails'
import Register from '@/views/Register'
import Shopinformation from '@/views/Shopinformation'
import BusReg from '@/views/BusReg'
import Settlement from '@/views/Settlement'
import Myaddress from '@/views/Myaddress'
import Forget from '@/views/Forget'
import Search from '@/views/Search'
import Tenderhall from '@/views/Tenderhall'
import Expertdatabase from '@/views/Expertdatabase'
import Takeshow from '@/components/Takeshow'
import Tenderhallhome from '@/views/Tenderhallhome'
import Releasetender from '@/views/Releasetender'
import Tenderhalltip from '@/views/Tenderhalltip'
import ZJdetails from '@/views/ZJdetails'
import TenderhallList from '@/views/TenderhallList'
import Zhifubao from '@/views/Zhifubao'
import Wutongzixun from '@/views/Wutongzixun'
import Toubiaocg from '@/views/Toubiaocg'
import Activity from '@/views/Activity'
import Gaiz from '@/views/Gaiz'
Vue.use(Router)

export default new Router({
  // mode: 'history',
  routes: [
    {
      path: '/',
      name: 'test',
      component: Tenderhallhome
    },
    {
      path: '/Zhifubao',
      name: 'Zhifubao',
      component: Zhifubao
    },
    {
      path: '/Wutongzixun',
      name: 'Wutongzixun',
      component: Wutongzixun
    },
    {
      path: '/Tenderhallhome',
      name: 'Tenderhallhome',
      component: Tenderhallhome
    },
    {
      path: '/Tenderhalltip',
      name: 'Tenderhalltip',
      component: Tenderhalltip,
      beforeEnter: (to, from, next) => {
        if (!sessionStorage.getItem('login')) {
          console.log(to.fullPath)
          next({
            path: '/Entry',
            query: { redirect: to.fullPath }
          })
        } else {
          next()
        }
      }
    },
    {
      path: '/Releasetender',
      name: 'Releasetender',
      component: Releasetender,
      beforeEnter: (to, from, next) => {
        if (!sessionStorage.getItem('login')) {
          console.log(to.fullPath)
          next({
            path: '/Entry',
            query: { redirect: to.fullPath }
          })
        } else {
          next()
        }
      }
    },
    {
      path: '/Tenderhall',
      name: 'Tenderhall',
      component: Tenderhall
    },
    {
      path: '/Expertdatabase',
      name: 'Expertdatabase',
      component: Expertdatabase
    },
    {
      path: '/Home',
      name: 'Home',
      component: Home
    },
    {
      path: '/List',
      name: 'List',
      component: List
    },
    {
      path: '/Goods',
      name: 'Goods',
      component: Goods
    },
    {
      path: '/Login',
      name: 'Login',
      component: Login
    },
    {
      path: '/Storeinfo',
      name: 'Storeinfo',
      component: Storeinfo,
      beforeEnter: (to, from, next) => {
        if (!sessionStorage.getItem('login')) {
          console.log(to.fullPath)
          next({
            path: '/Entry',
            query: { redirect: to.fullPath }
          })
        } else {
          next()
        }
      }
    },
    {
      path: '/Storelist',
      name: 'Storelist',
      component: Storelist
    },
    {
      path: '/Shoppingcart',
      name: 'Shoppingcart',
      component: Shoppingcart
    },
    {
      path: '/LoginS',
      name: 'LoginS',
      component: LoginS
    },
    {
      path: '/Entry',
      name: 'Entry',
      component: Entry
    },
    {
      path: '/EntryS',
      name: 'EntryS',
      component: EntryS
    },
    {
      path: '/Shopdetails',
      name: 'Shopdetails',
      component: Shopdetails
    },
    {
      path: '/Details',
      name: 'Details',
      component: Details
    },
    {
      path: '/Register',
      name: 'Register',
      component: Register
    },
    {
      path: '/Shopinformation',
      name: 'Shopinformation',
      component: Shopinformation
    },
    {
      path: '/BusReg',
      name: 'BusReg',
      component: BusReg
    },
    {
      path: '/Settlement',
      name: 'Settlement',
      component: Settlement
    },
    {
      path: '/Myaddress',
      name: 'Myaddress',
      component: Myaddress,
      beforeEnter: (to, from, next) => {
        if (!sessionStorage.getItem('login')) {
          console.log(to.fullPath)
          next({
            path: '/Entry',
            query: { redirect: to.fullPath }
          })
        } else {
          next()
        }
      }
    },
    {
      path: '/Forget',
      name: 'Forget',
      component: Forget
    },
    {
      path: '/Search',
      name: 'Search',
      component: Search
    },
    {
      path: '/Takeshow',
      name: 'Takeshow',
      component: Takeshow
    },
    {
      path: '/ZJdetails',
      name: 'ZJdetails',
      component: ZJdetails
    },
    {
      path: '/TenderhallList',
      name: 'TenderhallList',
      component: TenderhallList
    },
    {
      path: '/Toubiaocg',
      name: 'Toubiaocg',
      component: Toubiaocg
    },
    {
      path: '/Activity',
      name: 'Activity',
      component: Activity
    },
    {
      path: '/Gaiz',
      name: 'Gaiz',
      component: Gaiz
    }
  ]
})
